from django.contrib import admin
from .models import Scene, Trigger, Action, SceneExecutionLog


@admin.register(Scene)
class SceneAdmin(admin.ModelAdmin):
    list_display = ('id', 'name', 'owner', 'priority', 'enabled', 'created_at')
    list_filter = ('enabled', 'priority')
    search_fields = ('name',)
    ordering = ('-priority',)

@admin.register(Trigger)
class TriggerAdmin(admin.ModelAdmin):
    list_display = ('id', 'scene', 'type')
    list_filter = ('type',)

@admin.register(Action)
class ActionAdmin(admin.ModelAdmin):
    list_display = ('id', 'scene', 'device_id')
    list_filter = ('device_id',)

@admin.register(SceneExecutionLog)
class SceneExecutionLogAdmin(admin.ModelAdmin):
    list_display = ('id', 'scene', 'invoker', 'status', 'ts')
    list_filter = ('invoker', 'status')
